<?php require('connections/con_gl.php'); ?>
<?php
session_start();
cekAkses($_SESSION[akses],"L-8");
mysql_select_db($database_con_gl, $con_gl);

$query_l_kel = "SELECT id, gudang FROM gl_gudang ORDER BY gudang ASC";
$l_kel = mysql_query($query_l_kel, $con_gl) or die(mysql_error());
$row_l_kel = mysql_fetch_assoc($l_kel);
$totalRows_l_kel = mysql_num_rows($l_kel);
?>
<script type="text/javascript" src="js/ajax_data.js"></script>
<h1>EFEKTIVITAS KENDARAAN UNIT TLI</h1>
<p>Menampilkan data unit sesuai cabang</p>
<!-- Added by suwondo -->
Cabang :
<select name="cabang" id="cabang" onchange="cabang.value=''">
  <option value="ALL" <?php if (!(strcmp("ALL", $_GET[cabang]))) {echo "selected=\"selected\"";} ?>>Pilih Cabang</option>
  <?php
do {  
?>
  <option value="<?php echo $row_l_kel['id']?>"<?php if (!(strcmp($row_l_kel['id'], $_GET[cabang]))) {echo "selected=\"selected\"";} ?>><?php echo $row_l_kel['gudang']?></option>
  <?php
} while ($row_l_kel = mysql_fetch_assoc($l_kel));
  $rows = mysql_num_rows($l_kel);
  if($rows > 0) {
      mysql_data_seek($l_kel, 0);
	  $row_l_kel = mysql_fetch_assoc($l_kel);
  }
?>
</select>
&nbsp;Bulan Checkin &nbsp;
<select name="bulan" id="bulan">
 
  <?php
 	$selected = null;
	 $months = array(
                1 => 'Januari',
                2 => 'Februari',
                3 => 'Maret',
                4 => 'April',
                5 => 'Mei',
                6 => 'Juni',
                7 => 'Juli',
                8 => 'Agustus',
                9 => 'September',
                10 => 'Oktober',
                11 => 'November',
                12 => 'Desember');
				
					
			for($i = 1; $i <= 12; $i++){
				 	if($i <= 10)		 
					{
						$x = "0".$i;
					echo "<option value='$x'>$months[$i]</option>";
					}
					else
					{
					echo "<option value='$i'>$months[$i]</option>";
					}
				
			}
			
	?>
</select> 
Tahun 
<select name="tahun" id="tahun">
 
  <?php
	$now = date("Y");
	for($i=$now; $i>$now-17; $i--){
		echo "<option value='$i'>$i</option>";
	}
	?>
</select>
&nbsp;
<!-- Added by suwondo -->
<input type="hidden" name="cabang" id="cabang" />
<input type="hidden" name="txtcabang" id="txtcabang" />
<input type="button" value="Cetak" onclick="javascript: 
kirimRequest('components/efektivitasunit/isi.php','cabang='+document.getElementById('cabang').value+'&bulan='+document.getElementById('bulan').value+'&tahun='+document.getElementById('tahun').value, 'hasil', 'div'); " />
<div id="hasil"></div>